﻿@using System.Data;
@using System.Web;
@using DTcms.Web.MVC.Areas.Web.Controllers;
@using DTcms.Web.MVC.UI.Controllers;
@using DTcms.Model;
@{
   
   Layout = "~/Areas/Web/Views/" + ViewBag.TemplateSkin + "/web/Shared/_LayoutShow.cshtml";
   DTcms.Model.channel_site site = ViewData["site"] as DTcms.Model.channel_site;
   DTcms.Model.siteconfig config = ViewData["config"] as DTcms.Model.siteconfig;
   DTcms.Model.article m = ViewData["model"] as DTcms.Model.article;
   BaseController bc = ViewBag.BasePage as BaseController;
   Article_ShowController c = ViewBag.This as Article_ShowController;
   string category_title = bc.get_category_title(m.category_id, "资源下载");
   ViewBag.Title = m.title + " - " + category_title +" - " + site.name;
   DataTable list = null;
   string channel = "down";
}
@section HeaderContent{
   <link href="~/templates/@ViewBag.TemplateSkin/web/css/lightbox.css" rel="stylesheet" />
   <script src="~/templates/@ViewBag.TemplateSkin/web/js/lightbox.min.js"></script>
}
<div class="section clearfix">
  <!--右边-->
  <div class="list-right">
    <div class="sidebar-box">
      <div class="line30"></div>
      <h3>资源类别</h3>
      <ul class="navbar">
        @{
        list = bc.get_category_child_list(channel, 0);
        foreach(DataRow cdr1 in list.Rows){
        <li>
          <h4><a href="@bc.linkurl("down_list",cdr1["id"])">@cdr1["title"]</a></h4>
          <p>
            @{ 
            DataTable categoryList2 = bc.get_category_child_list(channel, Convert.ToInt32(cdr1["id"]));
            foreach(DataRow cdr2 in categoryList2.Rows){
               if(Convert.ToInt32(cdr2["id"]) == m.category_id){
               <a href="@bc.linkurl("down_list",cdr2["id"])" class="selected">@cdr2["title"]</a>
               }else{
               <a href="@bc.linkurl("down_list",cdr2["id"])">@cdr2["title"]</a>
               }
            }
            }
          </p>
        </li>
        }
        }
      </ul>
      <div class="line20"></div>
      <h3>推荐资源</h3>
      <div class="focus-list">
        <ul>
          @{ 
          DataTable redDown = bc.get_article_list(channel, 0, 4, "status=0 and is_red=1");
          foreach(DataRow dr in redDown.Rows){
          <li>
            <a title="@dr["title"]" href="@bc.linkurl("down_show",dr["id"])">
              <b><img src="@dr["img_url"]" /></b>
              <span>@dr["title"]</span>
            </a>
          </li>
          }
          }
        </ul>
      </div>
      <div class="line10"></div>
      <h3>人气排行</h3>
      <ul class="rank-list">
        @{ 
        DataTable hotDown = bc.get_article_list(channel, 0, 10, "status=0", "click desc,id desc");
        int hotcount = 0;
        foreach(DataRow hotdr in hotDown.Rows){
           if(hotcount == 1){
           <li class="active">
             <span>@DateTime.Parse(hotdr["add_time"].ToString()).ToString("MM-dd")</span>
             <i class="num">@hotcount</i><a href="@bc.linkurl("down_show",hotdr["id"])">@hotdr["title"]</a>
           </li>
           }else{
           <li>
             <span>@DateTime.Parse(hotdr["add_time"].ToString()).ToString("MM-dd")</span>
             <i class="num">@hotcount</i><a href="@bc.linkurl("down_show",hotdr["id"])">@hotdr["title"]</a>
           </li>
           }
        }
        }
      </ul>
    </div>
  </div>
  <!--/右边-->
  
  <!--左边-->
  <div class="list-auto">
    
    <div class="meta">
      <h1>@m.title</h1>
      <p class="meta-info">
        <span class="time">@m.add_time</span>
        <span class="comm"><script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_comment_count&id=@m.id"></script>人评论</span>
        <span class="view"><script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_article_click&id=@m.id&click=1"></script>次浏览</span>
        分类：@category_title
      </p>
    </div>
    
    <div class="entry">
      @Html.Raw(m.content)
    </div>
    
    <!--分享-->
    @RenderPage("~/Areas/Web/Views/" + ViewBag.TemplateSkin + "/web/Shared/partial_share_js.cshtml")
    <!--/分享-->
    <div class="line15"></div>
    
    <!--附件列表-->
    <h2 class="base-tit">
      <span>附件下载</span>
    </h2>
    <ul class="attach-list">
      @if(m.attach!=null){
         foreach(DTcms.Model.article_attach mt in m.attach){
         <li>
           <span><a href="javascript:;" onclick="downLink(@mt.point,'@(config.webpath)tools/download.ashx?site=@site.build_path&id=@mt.id');">点击下载</a></span>
           附件：@mt.file_name
           <i>大小：@(mt.file_size > 1024 ? (mt.file_size/1024f).ToString("#.##") + "MB" : mt.file_size.ToString() + "KB")</i>
           <i>下载：<script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_attach_count&id=@mt.id"></script>次</i>
           <i>所需积分：@mt.point 分</i>
         </li>
         }
      }
    </ul>
    <!--/附件列表-->
    
    <div class="line15"></div>
    <!--相关推荐-->
    <h2 class="base-tit">
      <span>相关资源</span>
    </h2>
    <div class="rel-list">
      <ul>
        @{ 
        DataTable relList = bc.get_article_list(channel, m.category_id, 4, "is_red=1 and id<>" + m.id);
        foreach(DataRow reldr in relList.Rows){
        <li>
          <div class="img-box">
            <a title="@reldr["title"]" href="@bc.linkurl("down_show",reldr["id"])">
              <img src="@reldr["img_url"]" />
            </a>
          </div>
          <div class="info">
            <h3><a title="@reldr["title"]" href="@bc.linkurl("down_show",reldr["id"])">@reldr["title"]</a></h3>
            <p>@reldr["zhaiyao"]</p>
            <span>@reldr["add_time"]</span>
          </div>
        </li>
        }
        }
        @if(relList.Rows.Count<1){
        <div class="nodata">暂无相关的资源...</div>
        }
      </ul>
    </div>
    <!--/相关推荐-->
    <div class="clear"></div>
    
    <!--用户评论-->
    @if(m.is_msg==1){
    <h2 class="base-tit">
      <i>共有<b><script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_comment_count&id=@m.id"></script></b>访客发表了评论</i>
      <span>网友评论</span>
    </h2>
    @RenderPage("~/Areas/Web/Views/" + ViewBag.TemplateSkin + "/web/Shared/partial_comment_box.cshtml")
    }
    <!--用户评论-->
    
  </div>
  <!--/左边-->
  
</div>